package console;

import javax.swing.AbstractAction;
import java.util.Iterator;

public abstract class ConsoleAction extends AbstractAction {
   final ActionProperties properties;
   public ConsoleAction() {
      super();
      properties = new ActionProperties();
   }
   public ConsoleAction(ActionProperties properties) {
      super();
      this.properties=properties;
   }
   public void checkProperties(ActionProperties currentState) {
   for (Iterator<String> e = properties.keySet().iterator(); e.hasNext();) {
         String key = e.next();
         if(!(currentState.get(key)==properties.get(key))) {
            setEnabled(false);
            return;
         }
      }
      setEnabled(true);
   }
}
